  <script>
  $(document).ready(function() {
    $("#date_created").datepicker();
    $('#preview').lightBox();
  });
  </script>

<h1 class="aligncenter grid_11">Enter Image Details</h1>
<div class="center grid_11 error" >
<?php 
	echo validation_errors();
?>
</div>
<?php 
if( !empty($uploaderrors)){ foreach ($uploaderrors as $error )  {?>
<p class='error' >
	<?php echo $error?>
</p>
<?php } }?>
<div class="grid_3 nicebutton alignleft margin_right10">
<a href="<?php
	if( !empty( $imgdata) ){
		echo 'uploads/'.$imgdata['file_name'];
	}
?>" title="<?php
	if( !empty( $imgdata) ){
		echo $imgdata['file_name'];
	}
?>" id="preview">
<img src='<?php
	if( !empty( $imgdata) ){
		echo 'uploads/'.$imgdata['thumb'];
	}
?>' 
width='<?php if( !empty( $imgdata) ){
		echo $imgdata['thumb_width'];
	}
?>'

/>
</a>
</div>
<?php
$attributes = array('class' => '', 'id' => 'imageuploadform');
$hidden = array('submitted' => true );
echo form_open($form_address, $attributes,$hidden); ?>
	<div class="grid_4 nicebutton">
		<div class="grid_2 alignleft niceform" >Title <span class="req">*</span></div>
		<div class="grid_3 clearleft" >
		<input type="text" size="25" id="title" class="niceform" name="title" <?php if( getError( $errors,'title') )echo 'class="error"';?> value="<?php echo set_value('title'); ?>"/>  
		</div>
		
		<div class="grid_2 clearleft alignleft niceform" >Description</div>
		<div class="grid_3 clearleft" >
		<textarea class="niceform" cols="25" id="description" name="description" ><?php echo set_value('description'); ?></textarea>
		</div>
		<div class="grid_2 clearleft alignleft niceform" >Short Description</div>
		<div class="grid_2 clearleft" >
		<textarea class="niceform" cols="25" id="short_description" name="short_description"  ><?php echo set_value('short_description'); ?></textarea>
		</div>
	</div>
	<div class="grid_4 nicebutton">
		<div class="grid_2 clearleft alignleft niceform" >Date Created</div>
		<div class="grid_3 clearleft" >
		<input type="text" class="niceform" size="12" name="date_created" id="date_created" <?php if( getError( $errors,'date_created') )echo 'class="error"';?> value="<?php echo set_value('date_created');?>"/>  
		</div>
		<div class="grid_2 clearleft alignleft niceform" >Category</div>
		<div class="grid_3 clearleft" >
		<?php 
		$additional = 'class="niceform"';
		echo form_dropdown('categories', $options, $cat_select+1,$additional);
		?>
		</div>
		<div class="grid_2 clearleft alignleft niceform" >New Category</div>
		<div class="grid_3 clearleft" >
		<input type="text" class="niceform" name="new_cat" size="20" value="<?php echo set_value('new_cat'); ?>"/>
		</div>
		<div class="grid_2 clearleft alignleft niceform" >Price</div> 
		<div class="grid_3 clearleft" >
		<input type="text" class="niceform" name="price" size="20" <?php if( getError( $errors,'price') )echo 'class="error"';?> value="<?php echo set_value('price'); ?>"/>
		</div>
	</div>
<div class="grid_11 alignright nicebutton margin_top20" >
<input type="submit" name="cancel" value="Cancel" />
<input type="submit" value="Accept" />
</div>
 
</form>